import asyncio


def aAsync(func, *args, **kwargs):
    def makeUp(args, kwargs):
        return func(*args, **kwargs)

    eventLoop = asyncio.get_event_loop()
    future = eventLoop.run_in_executor(None, makeUp, args, kwargs)
    return future


def toTask(func):
    def makeUp(*args, **kwargs):
        eventLoop = asyncio.get_event_loop()
        future = eventLoop.create_task(func(*args, **kwargs))
        return future

    return makeUp


def toTaskWCb(func):
    def makeUp(callback):
        def makeUps(*args, **kwargs):
            eventLoop = asyncio.get_event_loop()
            future = eventLoop.create_task(func(*args, **kwargs))
            future.add_done_callback(callback)
            return future

        return makeUps

    return makeUp


if __name__ == '__main__':
    help(aAsync)
    print('\n')
    help(toTask)
